/**package com.tomorrowbbs.config;

import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.cache.RedisCacheConfiguration;
import org.springframework.data.redis.cache.RedisCacheManager;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.serializer.GenericJackson2JsonRedisSerializer;
import org.springframework.data.redis.serializer.StringRedisSerializer;
import org.springframework.data.redis.serializer.RedisSerializationContext;

import java.time.Duration;

@Configuration
@EnableCaching
public class RedisConfig {



     *
     * @Bean
     *     public RedisCacheManager cacheManager(RedisConnectionFactory connectionFactory) {
     *         RedisCacheConfiguration config = RedisCacheConfiguration.defaultCacheConfig()
     *                 .entryTtl(Duration.ofMinutes(10)) // 默认缓存10分钟
     *                 .serializeKeysWith(RedisSerializationContext.SerializationPair.fromSerializer(new StringRedisSerializer()))
     *                 .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(new GenericJackson2JsonRedisSerializer()))
     *                 .disableCachingNullValues();
     *
     *         return RedisCacheManager.builder(connectionFactory)
     *                 .cacheDefaults(config)
     *                 .withCacheConfiguration("userCache", config.entryTtl(Duration.ofHours(1))) // 单独配置userCache的过期时间
     *                 .build();
     *     }
     * @param connectionFactory
     * @return


}*/